package oop12;

import org.slf4j.*;

import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class PeopleTest {
    //使用slf4j
    public static final Logger Log= LoggerFactory.getLogger("oop12.PeopleTest");

    public static void main(String[] args) {
        if(Log.isDebugEnabled())
            Log.debug("开始创建人类：");
        Scanner in=new Scanner(System.in);
        System.out.println("请输入人名：");
        People p=new People();
        p.setName(in.next());
        System.out.println("请输入年龄：");
        try {
            p.setAge(in.nextInt());
        } catch (AgeException e) {
            //e.printStackTrace();

            Log.error("年龄设置有问题",e);
        }catch (InputMismatchException e){
            Log.error("输入的不是数字！",e);
        }

        Log.info("输入的人的信息是："+p);
    }
}
